home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / oath.lha / oath / test / dll0.cc < prev    next >
C/C++ Source or Header  |  1991-08-29  |  2KB  |  109 lines

  1. #include "oath/dlList.h"
  2.  
  3. #include "oath/character.h"
  4.  
  5. #include "oath/localToken.h"
  6.  
  7. #include <iostream.h>
  8.  
  9. /////////////////////////////////////////////////////////////////////////////
  10.  
  11. #include "../src/ensure.cc"
  12.  
  13. #include "../src/typeRegisterP.cc"
  14.  
  15. #include "../src/exportP.cc"
  16.  
  17. #include "../src/oathCore.cc"
  18.  
  19. #include "../src/obj.cc"
  20.  
  21. #include "../src/token.cc"
  22.  
  23. #include "../src/localToken.cc"
  24.  
  25. #include "../src/character.cc"
  26.  
  27. #include "../src/bag.cc"
  28.  
  29. #include "../src/queue.cc"
  30.  
  31. #include "../src/seq.cc"
  32.  
  33. #include "../src/fifoQueue.cc"
  34.  
  35. #include "../src/deq.cc"
  36.  
  37. #include "../src/list.cc"
  38.  
  39. #include "../src/dlNodeP.cc"
  40.  
  41. #include "../src/dlList.cc"
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // Test of dlLists
  45.  
  46. main ()
  47.    {// Part One ////////////////////
  48.  
  49.     tokenA T = localTokenA::make();
  50.  
  51.     characterA A = characterA::make('A');
  52.     characterA B = characterA::make('B');
  53.     characterA C = characterA::make('C');
  54.     characterA D = characterA::make('D');
  55.  
  56.     cout << A << B << C << D << endl;
  57.  
  58.     dlListA L1 = dlListA::make() << A << B << C;
  59.     dlListA L2 = dlListA::make() << A << B << C;
  60.     dlListA L3 = dlListA::make(L2);
  61.  
  62.     if(L1.is(L2) || L1.is(L3))
  63.         cout << "is() failed!" << endl;
  64.     else
  65.         cout << "is() succeeded!" << endl;
  66.  
  67.     if(L1 == L2 && L1 == L3)
  68.         cout << "== succeeded!" << endl;
  69.     else
  70.         cout << "== failed!" << endl;
  71.  
  72.     if(L1.isEmpty() || L2.isEmpty() || L3.isEmpty())
  73.         cout << "isEmpty() failed!" << endl;
  74.     else
  75.         cout << "isEmpty() succeeded!" << endl;
  76.  
  77.     if(L1.contains(A) && L1.contains(B) && !L1.contains(D))
  78.         cout << "contains() succeeded!" << endl;
  79.     else
  80.         cout << "contains() failed!" << endl;
  81.  
  82.     cout << "There are " << L1.count() << " characters in L1: ";
  83.     posA P1 = L1.makePos();
  84.     while(P1())
  85.        {cout << characterA::isa(*P1);
  86.         ++P1;
  87.        }
  88.     cout << endl;
  89.  
  90.     cout << "The second character is "
  91.          << characterA::isa(L1[1]) << endl;
  92.  
  93.     objA O;
  94.     L2 >> O;
  95.     cout << "The first character removed is " 
  96.          << characterA::isa(O) << endl;
  97.  
  98.     cout << "There are " << L2.count() << " characters in L2: ";
  99.     posA P2 = L2.makePos();
  100.     while(P2())
  101.        {cout << characterA::isa(*P2);
  102.         ++P2;
  103.        }
  104.     cout << endl;
  105.  
  106.    }
  107.  
  108.  
  109.